package org.shoukaiseki.aqoeous.utils;

import java.util.Collection;
import java.util.Iterator;

/**
 * <br>
 *
 * @author 蒋カイセキ    Japan-Tokyo  18-12-5 下午4:07<br>
 * ブログ http://www.shoukaiseki.top/<br>
 * E-メール jiang28555@Gmail.com<br>
 **/
public class CollectionUtils {


    /**
     * 类似 collection.addAll(iterator) ,多了去重复功能
     * @param collection
     * @param iterator
     */
    public static void addAll(Collection collection, Iterator iterator){
        while (iterator.hasNext()){
            Object obj=iterator.next();
            if(!collection.contains(obj)){
                collection.add(obj);
            }
        }
    }

}

